<?php
	require_once 'Vehicle.php';

	class Truck extends Vehicle {
		protected $load;		//current load;
		protected $maxLoad;		//maximum load;
		
		public function  __construct($model, $color, $maxSpeed, $hp, $load, $maxLoad) {
			if (is_int($maxLoad) && $maxLoad>=0){
				$this->maxLoad=$maxLoad;
			}
			
			if (is_int($load) && $load>=0 && $load<$this->maxLoad){
				$this->load=$load;
			}
			
			parent::__construct($model, $color, $maxSpeed, $hp);
			$this->type = "Truck";
		}
		
		public function loadTruck($newLoad){
			if ($newLoad<$this->maxLoad && is_int($newLoad)){
				return $this->load+=$newLoad;
			}
		}
		
		public function printInfo(){
			echo "This vehicle is a ". $this->type . " and it is "  .$this->color . ". The " . $this->type . " is a "
				. $this->model . " and its maximum speed is " . $this->maxSpeed .
				". Also, it has " . $this->hp . " horse power and is loaded with "
				. $this->load . " kg while its maximum load is " . $this->maxLoad . " kg.";
		}
	}

	$newTruck = new Truck ("UAZ", "Green", 80, 60, 300, 600);
	$newTruck->loadTruck(150);
	$newTruck->printInfo();
?>